//
//  FirstViewController.m
//  Kao
//
//  Created by mohe001 on 16/1/22.
//  Copyright © 2016年 mohekeji. All rights reserved.
//

#import "FirstViewController.h"
#import "FirstTableViewCell.h"
@interface FirstViewController ()

@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 3;
}


-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:( NSIndexPath *)indexPath
{
    return 78;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 3;
    }else if (section == 1){
        return 3;
    }else{
        
        return 3;
    }
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell1"];
        return cell;
    }if(indexPath.row  == 1){
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell2"];
        return cell;
    }if(indexPath.row  == 2){
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell3"];
        return cell;
        
    }else{
        NSString *CellIdentifier = @"FirstTableViewCell";
        FirstTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell==nil) {
            cell = [[[NSBundle mainBundle]loadNibNamed:@"FirstTableViewCell" owner:self options:nil]lastObject];
        }
        return  cell;
    }
    
}


-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *headerView =[[UIView alloc]initWithFrame:CGRectMake(0,0,320,50)];
    headerView.backgroundColor = [UIColor colorWithRed:177/255.0 green:0/255.0 blue:255/255.0 alpha:1]; ////////改色//headerView 改颜色
    
    UILabel *label =[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 28)];
    if (section == 0) {
        label.text =@"第一组";
    }else{
        if (section == 1) {
            label.text =@"第二组";
        }else{
            label.text =@"第三组";
        }
    }
    
    label.backgroundColor =[UIColor colorWithRed:166/255.0 green:255/255.0 blue:143/255.0 alpha:1]; ////////组名Label改色
    [headerView addSubview:label];
    return headerView;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
